package tut.mysql.load.loadThread;

import tut.mysql.db.Db;

public class DeliverThread extends InsertCtl implements Runnable {

	public static String DELIVER_TABLE = "deliver_log_test";
	public String file_path = "/var/tmp/deliver_log_test.tsv";

	public DeliverThread(int queries, Db db) {
		super(db);

    	StringBuilder sql = new StringBuilder();
		sql.append("LOAD DATA LOCAL INFILE '").append(file_path).append("'");
		sql.append(" REPLACE");
		sql.append(" INTO TABLE ").append("deliver_log_test");
		sql.append(" FIELDS");
		sql.append("  TERMINATED BY '\\t'");
		sql.append("  ESCAPED BY '\\\\'");
		sql.append(" LINES");
		sql.append("  STARTING BY ''");
		sql.append("  TERMINATED BY '\\n'");
		sql.append(" IGNORE 1 LINES");
		sql.append(" (");
		sql.append("date,ignore_type,error_type,error_msg,log_type,query_string,ip,user_agent,seller_id,buyer_id,buyer_type,terminal_type," +
				"click_date,uid,xuid,suid,buid,carrier_id,model_id,cvpoint,site_id,item_id,location_id,campaign_id," +
				"article_id,link_id,image_id,keyword_id,cost,wholesale,retail,cv_app_id,app_store_id,app_sdk_id,xuniq,cvpoint_type," +
				"sku_id,xtrack,certify_type,origin_cv_id,xtid,install_cv )");

		this.sql = sql.toString();


		this.maxQueries = queries;
	}

}
